package com.itheima.app.controller.omsController;

import com.itheima.app.manager.omsManager.OmsOrderSettingManager;
import com.itheima.commons.R;
import com.itheima.domain.db.oms.OmsOrderSetting;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 订单设置
 *
 * @author DogeGuo
 */
@CrossOrigin    //跨域
@RestController
public class OmsOrderSettingController {
    @Autowired
    OmsOrderSettingManager omsOrderSettingManager;

    /**
     * 获取指定订单设置
     * @param id
     * @return
     */
    @GetMapping("/orderSetting/{id}")
    public R findById(@PathVariable Integer id){
        OmsOrderSetting omsOrderSetting = omsOrderSettingManager.findById(id);
        return R.ok(omsOrderSetting);
    }

    /**
     * 修改指定订单设置
     * @param id
     * @param omsOrderSetting
     * @return
     */
    @PostMapping("orderSetting/update/{id}")
    public R updateInfo(@PathVariable Integer id ,@RequestBody OmsOrderSetting omsOrderSetting){
        omsOrderSettingManager.updateInfo(id,omsOrderSetting);
        return R.ok(null);
    }
}
